<!--<html>-->
<fieldset>
  <div><legend>题库</legend></div>
  <div class="tablebg">
    <div id="pager">
      <%- partial('pager', {page:page, n:n}) %>
      <div class="fr" id="filter">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-search"></i></span>
          <input type="text" id="search" style="width:160px;" <% if (search) { %>value="<%= search %>"<% } %> title="Title or Tag or Source" placeholder=" title or tag or source">
        </div>
        <div>
          <a class="uibtn uibtn-mini" href="javascript:;" id="fil">Filter</a>
        </div>
        <div>
          <a class="uibtn uibtn-mini" href="javascript:;" id="reset">Reset</a>
        </div>
      </div>
    </div>
    <div id="tablediv">
      <table class="table table-cf" style="table-layout:fixed;" id="problemset">
        <thead>
          <tr>
            <th style="width:65px;">#</th>
            <th>Title</th>
            <th style="width:70px;"></th>
            <th style="width:150px;">Source</th>
            <th style="width:150px;">Ratio(AC/submit)</th>
          </tr>
        </thead>
        <tbody>
        <% if (!problems || problems.length == 0) { %>
          <tr class="odd">
            <td class="error-text center" colspan="6">No Problems are matched.</td>
          </tr>
        <% } else { %>
        <% problems.forEach(function(p, i){ %>
        <% var c, s; %>
        <% if (i % 2 == 1) { %>
        <% c = 'even'; %>
        <% } else { %>
        <% c = 'odd'; %>
        <% } %>
        <% if (R[p.problemID] == 1) { %>
        <% s = 'WA'; %>
        <% } else if (R[p.problemID] == 2) { %>
        <% s = 'AC'; %>
        <% } %>
          <tr class="<%= c %>">
            <td class="center <%= s %>"><%= p.problemID %></td>
            <td>
            <% if (p.tags && p.tags.length > 0) { %>
              <div class="table-tab prob-tag">
              <% p.tags.sort(function(a, b){return a-b;}).forEach(function(t, i){ %>
                <% if (i > 0) { %>,<% } %>
                <a class="tag" href="javascript:;" title="<%= Pt[t] %>">
                  <%= Tag[t] %>
                </a>
              <% }); %>
              </div>
            <% } %>
              <a href="/problem?pid=<%= p.problemID %>"><%= p.title %></a>
            </td>
            <td <% if (s) { %>class="<%= s %>-fill"<% } %>>
              <span class="act-item">
                <a id="gotosubmit" class="checklogin" href="javascript:;" pid="<%= p.problemID %>">
                  <img src="/img/submit.png" title="Submit" alt="submit"/>
                </a>
              </span>
            </td>
            <td class="ellipsis">
              <a href="javascript:;" style="font-size:12px;" class="tag" title="<%= p.source %>"><%= p.source %></a>
            </td>
          <% var res = '0.00'; %>
          <% if (p.submit > 0) res = (p.AC/p.submit*100).toFixed(2); %>
            <td class="center">
              <%= res %>%(<a href="/status?pid=<%= p.problemID%>&result=2"><%= p.AC %></a>/<a href="/status?pid=<%= p.problemID %>"><%= p.submit %></a>)
            </td>
          </tr>
        <% }); %>
        <% } %>
        </tbody>
      </table>
    </div>
  </div>
</fieldset>